
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Menu1 extends JFrame {

	private JButton start = new JButton("开始游戏");
	public Menu1() {
		setBak(); // 调用背景方法
		Container c = getContentPane(); // 获取JFrame面板
		c.setLayout(new BorderLayout());//设置布局
		JPanel jp = new JPanel(); // 创建个JPanel
		jp.setOpaque(false); // 把JPanel设置为透明 这样就不会遮住后面的背景 这样你就能在JPanel随意加组件了
		
		jp.add(start,BorderLayout.CENTER);
		c.add(jp);
		setSize(750, 750);
		setVisible(true);
	}

	public void setBak() {
		((JPanel) this.getContentPane()).setOpaque(false);
		ImageIcon background = new ImageIcon("D:\\eclipse-workspace\\FlappyBird\\picture\\pic9.png");
		background.setImage(background.getImage().getScaledInstance(750, 750, Image.SCALE_DEFAULT));// 设置图片大小
		JLabel backgroundLabel = new JLabel(background);
		this.getLayeredPane().add(backgroundLabel, new Integer(Integer.MIN_VALUE));
		backgroundLabel.setBounds(0, 0, background.getIconWidth(), background.getIconHeight());
	}

	public static void Menu1(String[] args) {
		Menu1 s = new Menu1();
		s.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

}